#include "afficher_cacher.h"


//fait clignoter un objet (en l'affichant et en le cachant)
//REMARQUE : il faut travailler sur la propriété du g_object qui s'appelle "visibility"
//texte du TODO :  * voir comment afficher/cacher un canevas => clignotement

ONCE_FCT_START(cacher,rect)
{
	g_object_set(G_OBJECT(rect),
	 "visibility",GOO_CANVAS_ITEM_INVISIBLE,
	  NULL);
	  ONCE(montrer,rect);
ONCE_FCT_END;

ONCE_FCT_START(montrer,rect)
{
	g_object_set(G_OBJECT(rect),"visibility",GOO_CANVAS_ITEM_VISIBLE,NULL);
	ONCE(cacher,rect);
ONCE_FCT_END;

int main(int argc,char** argv)
{
	GtkWidget* win,*canvas;
	GooCanvasItem* root,*rect,*groupe,*rect2;
	GdkPixbuf* fp=NULL;
	GError* er=NULL;

	CANVAS_WIN_ROOT_NEW(canvas,win,root,320,240);
	groupe = goo_canvas_group_new(root,NULL);
	printf("np\n");
	#if 0
	rect = goo_canvas_rect_new(groupe,50,50,100,100,NULL);
	rect2 = goo_canvas_rect_new(groupe,60,60,100,100,NULL);
	#else
	fp= gdk_pixbuf_new_from_file("dessin_simple.png",&er);
	if(er)
	{
		printf("%s\n",er->message);
	}
	printf("pt fp :%d\n",fp);
	rect = goo_canvas_image_new(groupe,fp,60,60,NULL);
	printf("np\n");
	rect2 = goo_canvas_image_new(groupe,fp,40,60,NULL);
	#endif

	g_print("np");

	ONCE(cacher,rect);

	gtk_main();

	return 0;

}